<?php
namespace Admin\Controller;

use Utuo\BackgroundController;

class CustomerManagerConfigController extends BackgroundController {
	
	private $cid = 0;
	
	public function _initialize() {
		$this->cid = I('cid', 0, "intval");
		$this->setControllerTitle("客户后台管理");
		$this->setActionTitle(array(
					'index' => '客户后台管理',
			   ), "", "cid={$this->cid}");
		$this->setActionNav(array(
					'index',
			   ));
	}
	
	public function indexAction() {
		$customerManagerConfig = M("CustomerManagerConfig")->find($this->cid);
		if( !$customerManagerConfig ) {
			$customerManagerConfig = array(
					'id' => $this->cid,
					'form_text' => '欢迎登录',
					'login_logo' => '',
					'logon_logo' => '', );
			M("CustomerManagerConfig")->add( $customerManagerConfig );
		}
		$this->assign("customerManagerConfig", $customerManagerConfig);
		$this->display();
	}
	
	public function customerManagerConfigSaveAction() {
		$m = M("CustomerManagerConfig");
		$m->create() and false !== $m->save() and $this->ajaxSuccess("保存成功");
		$this->ajaxError("保存失败");
	}
	
}